"use strict";
var RendererExtension = function(camprop) {
    this.prop = camprop;
};

RendererExtension.prototype = {
    configStereoEffect: function(isOpen) {
        if (!isOpen) {
          return;
        }
        if (!this.prop.stereoEffect) {
          this.prop.stereoEffect = new THREE.StereoEffect(this.prop.renderer);
          this.prop.stereoEffect.setSize(window.innerWidth,window.innerHeight);
        }

    },

    configOrbitControls: function(isOpen) {
        this.prop.orbitControls = new THREE.OrbitControls(this.prop.camera, this.prop.renderElement);
        this.prop.orbitControls.noPan = true;
        this.prop.orbitControls.noZoom = true;
    },

    configDeviceOrientation: function() {
        function setOrientationControls(e) {
        if (!e.alpha) {
            return;
        }

        this.prop.orientationControls = new THREE.DeviceOrientationControls(this.prop.camera, true);
        this.prop.orientationControls.connect();
        this.prop.orientationControls.update();
        // this.prop.renderElement.addEventListener('click', fullscreen, false);

        $("#gyro").attr('src', 'image/gyroscope_selected.png');

        window.removeEventListener('deviceorientation', setOrientationControls, true);
        }
        window.addEventListener('deviceorientation', setOrientationControls, true);
    },

};